﻿using System;
using DNT.RavenQA.Core.Models;
using Rhino.Mocks;
using Xunit;

namespace DNT.RavenQA.Core.Tests.Models
{
    public class EntityTests
    {
        [Fact]
        public void Equality()
        {
            var entity1 = MockRepository.GenerateStub<Entity<Int32>>();
            entity1.Stub(i => i.Id).Return("entity/1");
            Assert.Equal(entity1, entity1);

            var entity2 = MockRepository.GenerateStub<Entity<Int32>>();
            entity2.Stub(i => i.Id).Return("entity/1");
            Assert.Equal(entity1, entity2);

            // TODO: I think Rhino has a bug, because "GetHashCode" is not called on unproxied type.
            //Assert.Equal(entity1.GetHashCode(), entity2.GetHashCode());

            var entity3 = MockRepository.GenerateStub<Entity<Int32>>();
            entity3.Stub(i => i.Id).Return("entity/2");
            Assert.NotEqual(entity2, entity3);

            // TODO: I think Rhino has a bug, because "GetHashCode" is not called on unproxied type.
            // Assert.NotEqual(entity2.GetHashCode(), entity3.GetHashCode());
        }
    }
}